<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
  <title>Description of example2</title>
  <meta name="keywords" content="example2">
  <meta name="description" content="example demonstrating reading in an FVCOM mesh and smoothing the bathymetry">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="generator" content="m2html v1.5 &copy; 2003-2005 Guillaume Flandin">
  <meta name="robots" content="index, follow">
  <link type="text/css" rel="stylesheet" href="../m2html.css">
</head>
<body>
<a name="_top"></a>
<div><a href="../index.html">Home</a> &gt;  <a href="index.html">fvcom_prepro</a> &gt; example2.m</div>

<!--<table width="100%"><tr><td align="left"><a href="../index.html"><img alt="<" border="0" src="../left.png">&nbsp;Master index</a></td>
<td align="right"><a href="index.html">Index for fvcom_prepro&nbsp;<img alt=">" border="0" src="../right.png"></a></td></tr></table>-->

<h1>example2
</h1>

<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>example demonstrating reading in an FVCOM mesh and smoothing the bathymetry</strong></div>

<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>This is a script file. </strong></div>

<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre class="comment"> example demonstrating reading in an FVCOM mesh and smoothing the bathymetry

 function example

 DESCRIPTION:
    Read in FVCOM mesh
    Read in FVCOM bathymetry
    Smooth bathymetry
    Dump new bathymetry

 INPUT
   
 OUTPUT:
    Smoothed Bathymetry File

 EXAMPLE USAGE
    example2

 Author(s):  
    Geoff Cowles (University of Massachusetts Dartmouth)

 Revision history
   
==============================================================================</pre></div>

<!-- crossreference -->
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
This function calls:
<ul style="list-style-image:url(../matlabicon.gif)">
<li><a href="plot_field.html" class="code" title="function plot_field(Mobj,PlotField,varargin)">plot_field</a>	Plot the mesh, user defined field, open boundary nodes, and river points</li><li><a href="read_fvcom_bath.html" class="code" title="function [h] = read_fvcom_bath(bathfile)">read_fvcom_bath</a>	Read fvcom bathymetry file</li><li><a href="read_fvcom_mesh.html" class="code" title="function [Mobj] = read_fvcom_mesh(gridfile)">read_fvcom_mesh</a>	Read fvcom mesh file into Matlab mesh object</li><li><a href="setup_metrics.html" class="code" title="function [Mobj]  = setup_metrics(Mobj)">setup_metrics</a>	Setup metrics for mesh object Mesh</li><li><a href="smoothfield.html" class="code" title="function [field]  = smoothfield(fieldin,Mobj,SmoothFactor,nLoops,SmoothPts)">smoothfield</a>	Smooth a vertex-based field using averages</li><li><a href="write_FVCOM_bath.html" class="code" title="function write_FVCOM_bath(Mobj,filename)">write_FVCOM_bath</a>	Write bathymetry to FVCOM format bathymetry file</li></ul>
This function is called by:
<ul style="list-style-image:url(../matlabicon.gif)">
</ul>
<!-- crossreference -->



<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre>0001 <span class="comment">% example demonstrating reading in an FVCOM mesh and smoothing the bathymetry</span>
0002 <span class="comment">%</span>
0003 <span class="comment">% function example</span>
0004 <span class="comment">%</span>
0005 <span class="comment">% DESCRIPTION:</span>
0006 <span class="comment">%    Read in FVCOM mesh</span>
0007 <span class="comment">%    Read in FVCOM bathymetry</span>
0008 <span class="comment">%    Smooth bathymetry</span>
0009 <span class="comment">%    Dump new bathymetry</span>
0010 <span class="comment">%</span>
0011 <span class="comment">% INPUT</span>
0012 <span class="comment">%</span>
0013 <span class="comment">% OUTPUT:</span>
0014 <span class="comment">%    Smoothed Bathymetry File</span>
0015 <span class="comment">%</span>
0016 <span class="comment">% EXAMPLE USAGE</span>
0017 <span class="comment">%    example2</span>
0018 <span class="comment">%</span>
0019 <span class="comment">% Author(s):</span>
0020 <span class="comment">%    Geoff Cowles (University of Massachusetts Dartmouth)</span>
0021 <span class="comment">%</span>
0022 <span class="comment">% Revision history</span>
0023 <span class="comment">%</span>
0024 <span class="comment">%==============================================================================</span>
0025 
0026 clear all; close all;
0027 
0028 <span class="comment">% read the Mesh from an FVCOM grid file</span>
0029 Mobj = <a href="read_fvcom_mesh.html" class="code" title="function [Mobj] = read_fvcom_mesh(gridfile)">read_fvcom_mesh</a>(<span class="string">'skg4.3_grd.dat'</span>);
0030 
0031 <span class="comment">% read the bathymetry from an FVCOM grid file</span>
0032 Mobj.h = <a href="read_fvcom_bath.html" class="code" title="function [h] = read_fvcom_bath(bathfile)">read_fvcom_bath</a>(<span class="string">'skg4.3_dep.dat'</span>);  Mobj.have_bath = true;
0033 
0034 <span class="comment">% smooth bathymetry with 4 iterations of explicit smoother</span>
0035 <a href="plot_field.html" class="code" title="function plot_field(Mobj,PlotField,varargin)">plot_field</a>(Mobj,Mobj.h,<span class="string">'title'</span>,<span class="string">'original bathymetry'</span>)
0036 Mobj = <a href="setup_metrics.html" class="code" title="function [Mobj]  = setup_metrics(Mobj)">setup_metrics</a>(Mobj);
0037 [Mobj.h] = <a href="smoothfield.html" class="code" title="function [field]  = smoothfield(fieldin,Mobj,SmoothFactor,nLoops,SmoothPts)">smoothfield</a>(Mobj.h,Mobj,0.5,4);
0038 <a href="plot_field.html" class="code" title="function plot_field(Mobj,PlotField,varargin)">plot_field</a>(Mobj,Mobj.h,<span class="string">'title'</span>,<span class="string">'smoothed bathymetry'</span>);
0039 
0040 <span class="comment">% dump bathymetry</span>
0041 <a href="write_FVCOM_bath.html" class="code" title="function write_FVCOM_bath(Mobj,filename)">write_FVCOM_bath</a>(Mobj,<span class="string">'skg4.3_dep_smoothed.dat'</span>)
0042</pre></div>
<hr><address>Generated on Wed 02-Nov-2011 21:58:00 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" title="Matlab Documentation in HTML">m2html</a></strong> &copy; 2005</address>
</body>
</html>